package com.hkzhao.reportingsystem.component;

import com.hkzhao.reportingsystem.service.DoctorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//超时触发取消注册的处理者
@Component
@RabbitListener(queues = "reportsystem.doctor.cancle")
public class OverTimeCancleReceiver {
    private static Logger LOGGER = LoggerFactory.getLogger(OverTimeCancleReceiver.class);
    @Autowired
    private DoctorService doctorService;
    @RabbitHandler
    public void handle(String username)
    {
        LOGGER.info("receive delay message username:{}",username);
        doctorService.cancelRegister(username);
    }
}
